package com.google.ads.b;

import android.app.Activity;
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.net.Uri;
import android.net.Uri.Builder;
import android.os.Handler;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import com.google.ads.AdActivity;
import com.google.ads.a;
import com.google.ads.aa;
import com.google.ads.ah;
import com.google.ads.ai;
import com.google.ads.ak;
import com.google.ads.aq;
import com.google.ads.ar;
import com.google.ads.as;
import com.google.ads.g;
import com.google.ads.h;
import com.google.ads.i;
import com.google.ads.n;
import com.google.ads.o;
import com.google.ads.q;
import com.google.ads.util.AdUtil;
import com.google.ads.util.ae;
import com.google.ads.z;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Set;

public class r
{
  private static final Object a = new Object();
  private final as b;
  private j c;
  private com.google.ads.d d;
  private w e;
  private c f;
  private y g;
  private Handler h;
  private long i;
  private boolean j;
  private boolean k;
  private boolean l;
  private boolean m;
  private boolean n;
  private SharedPreferences o;
  private long p;
  private o q;
  private boolean r;
  private LinkedList s;
  private LinkedList t;
  private int u = -1;
  private Boolean v;
  private com.google.ads.ac w;
  private com.google.ads.ad x;
  private ah y;
  private String z = null;

  public r(a parama, Activity paramActivity, g paramg, String paramString, ViewGroup paramViewGroup, boolean paramBoolean)
  {
    this.r = paramBoolean;
    this.e = new w();
    this.c = null;
    this.d = null;
    this.k = false;
    this.h = new Handler();
    this.p = 60000L;
    this.l = false;
    this.n = false;
    this.m = true;
    if (paramActivity == null)
    {
      aq localaq2 = aq.a();
      h localh2;
      com.google.ads.j localj2;
      if ((parama instanceof h))
      {
        localh2 = (h)parama;
        if (!(parama instanceof com.google.ads.j))
          break label156;
        localj2 = (com.google.ads.j)parama;
        label114: if (paramg != null)
          break label162;
      }
      label156: label162: for (x localx2 = x.a; ; localx2 = x.a(paramg))
      {
        this.b = new as(localaq2, parama, localh2, localj2, paramString, null, null, paramViewGroup, localx2);
        return;
        localh2 = null;
        break;
        localj2 = null;
        break label114;
      }
    }
    while (true)
    {
      synchronized (a)
      {
        this.o = paramActivity.getApplicationContext().getSharedPreferences("GoogleAdMobAdsPrefs", 0);
        if (paramBoolean)
        {
          long l1 = this.o.getLong("Timeout" + paramString, -1L);
          if (l1 < 0L)
          {
            this.i = 5000L;
            aq localaq1 = aq.a();
            if (!(parama instanceof h))
              break label437;
            localh1 = (h)parama;
            if (!(parama instanceof com.google.ads.j))
              break label443;
            localj1 = (com.google.ads.j)parama;
            Context localContext = paramActivity.getApplicationContext();
            if (paramg != null)
              break label449;
            localx1 = x.a;
            this.b = new as(localaq1, parama, localh1, localj1, paramString, paramActivity, localContext, paramViewGroup, localx1);
            this.q = new o(this);
            this.s = new LinkedList();
            this.t = new LinkedList();
            a();
            AdUtil.h((Context)this.b.f.a());
            this.w = new com.google.ads.ac();
            this.x = new com.google.ads.ad(this);
            this.v = null;
            this.y = null;
            return;
          }
          this.i = l1;
        }
      }
      this.i = 60000L;
      continue;
      label437: h localh1 = null;
      continue;
      label443: com.google.ads.j localj1 = null;
      continue;
      label449: x localx1 = x.a(paramg, paramActivity.getApplicationContext());
    }
  }

  private void a(ah paramah, Boolean paramBoolean)
  {
    Object localObject = paramah.d();
    if (localObject == null)
    {
      localObject = new ArrayList();
      ((List)localObject).add("http://e.admob.com/imp?ad_loc=@gw_adlocid@&qdata=@gw_qdata@&ad_network_id=@gw_adnetid@&js=@gw_sdkver@&session_id=@gw_sessid@&seq_num=@gw_seqnum@&nr=@gw_adnetrefresh@&adt=@gw_adt@&aec=@gw_aec@");
    }
    String str = paramah.b();
    a((List)localObject, paramah.a(), str, paramah.c(), paramBoolean, this.e.d(), this.e.e());
  }

  private void a(List paramList, String paramString)
  {
    Object localObject;
    if (paramList == null)
    {
      localObject = new ArrayList();
      ((List)localObject).add("http://e.admob.com/nofill?ad_loc=@gw_adlocid@&qdata=@gw_qdata@&js=@gw_sdkver@&session_id=@gw_sessid@&seq_num=@gw_seqnum@&adt=@gw_adt@&aec=@gw_aec@");
    }
    while (true)
    {
      a((List)localObject, null, null, paramString, null, this.e.d(), this.e.e());
      return;
      localObject = paramList;
    }
  }

  private void a(List paramList, String paramString1, String paramString2, String paramString3, Boolean paramBoolean, String paramString4, String paramString5)
  {
    String str1 = AdUtil.a((Context)this.b.f.a());
    z localz = z.a();
    String str2 = localz.b().toString();
    String str3 = localz.c().toString();
    Iterator localIterator = paramList.iterator();
    while (localIterator.hasNext())
      new Thread(new n(ai.a((String)localIterator.next(), (String)this.b.d.a(), paramBoolean, str1, paramString1, paramString2, paramString3, str2, str3, paramString4, paramString5), (Context)this.b.f.a())).start();
    this.e.b();
  }

  public void a()
  {
    try
    {
      this.f = new c(this.b, ((x)this.b.k.a()).b());
      this.f.setVisibility(8);
      this.g = y.a(this, e.c, true, this.b.b());
      this.f.setWebViewClient(this.g);
      ar localar = (ar)((aq)this.b.a.a()).a.a();
      if ((AdUtil.a < ((Integer)localar.a.a()).intValue()) && (!((x)this.b.k.a()).a()))
      {
        com.google.ads.util.d.a("Disabling hardware acceleration for a banner.");
        this.f.b();
      }
      return;
    }
    finally
    {
      localObject = finally;
      throw localObject;
    }
  }

  public void a(float paramFloat)
  {
    try
    {
      long l1 = this.p;
      this.p = (()(1000.0F * paramFloat));
      if ((q()) && (this.p != l1))
      {
        d();
        e();
      }
      return;
    }
    finally
    {
      localObject = finally;
      throw localObject;
    }
  }

  public void a(int paramInt)
  {
    try
    {
      this.u = paramInt;
      return;
    }
    finally
    {
      localObject = finally;
      throw localObject;
    }
  }

  public void a(long paramLong)
  {
    synchronized (a)
    {
      SharedPreferences.Editor localEditor = this.o.edit();
      localEditor.putLong("Timeout" + this.b.d, paramLong);
      localEditor.commit();
      if (this.r)
        this.i = paramLong;
      return;
    }
  }

  public void a(View paramView)
  {
    ((ViewGroup)this.b.g.a()).removeAllViews();
    ((ViewGroup)this.b.g.a()).addView(paramView);
  }

  public void a(View paramView, ak paramak, ah paramah, boolean paramBoolean)
  {
    try
    {
      com.google.ads.util.d.a("AdManager.onReceiveGWhirlAd() called.");
      this.k = true;
      this.y = paramah;
      if (this.b.a())
      {
        a(paramView);
        a(paramah, Boolean.valueOf(paramBoolean));
      }
      this.x.a(paramak);
      com.google.ads.c localc = (com.google.ads.c)this.b.m.a();
      if (localc != null)
        localc.a((a)this.b.h.a());
      return;
    }
    finally
    {
    }
  }

  public void a(aa paramaa)
  {
    try
    {
      this.c = null;
      if (paramaa.d())
      {
        a(paramaa.e());
        if (!this.l)
          e();
      }
      while (true)
      {
        this.x.a(paramaa, this.d);
        return;
        if (this.l)
          d();
      }
    }
    finally
    {
    }
  }

  public void a(com.google.ads.d paramd)
  {
    while (true)
    {
      try
      {
        if (o())
        {
          com.google.ads.util.d.e("loadAd called while the ad is already loading, so aborting.");
          return;
        }
        if (AdActivity.c())
        {
          com.google.ads.util.d.e("loadAd called while an interstitial or landing page is displayed, so aborting");
          continue;
        }
      }
      finally
      {
      }
      if ((AdUtil.c((Context)this.b.f.a())) && (AdUtil.b((Context)this.b.f.a())))
      {
        long l1 = this.o.getLong("GoogleAdMobDoritosLife", 60000L);
        if (q.a((Context)this.b.f.a(), l1))
          q.a((Activity)this.b.e.a());
        this.k = false;
        this.s.clear();
        this.d = paramd;
        if (this.w.a())
        {
          this.x.a(this.w.b(), paramd);
        }
        else
        {
          this.c = new j(this);
          this.c.a(paramd);
        }
      }
    }
  }

  public void a(com.google.ads.e parame)
  {
    try
    {
      this.c = null;
      if (parame == com.google.ads.e.c)
      {
        a(60.0F);
        if (!q())
          f();
      }
      if (this.b.b())
      {
        if (parame != com.google.ads.e.b)
          break label126;
        this.e.B();
      }
      while (true)
      {
        com.google.ads.util.d.c("onFailedToReceiveAd(" + parame + ")");
        com.google.ads.c localc = (com.google.ads.c)this.b.m.a();
        if (localc != null)
          localc.a((a)this.b.h.a(), parame);
        return;
        label126: if (parame == com.google.ads.e.c)
          this.e.z();
      }
    }
    finally
    {
    }
  }

  public void a(Runnable paramRunnable)
  {
    this.h.post(paramRunnable);
  }

  public void a(String paramString)
  {
    Uri localUri = new Uri.Builder().encodedQuery(paramString).build();
    StringBuilder localStringBuilder = new StringBuilder();
    HashMap localHashMap = AdUtil.b(localUri);
    Iterator localIterator = localHashMap.keySet().iterator();
    while (localIterator.hasNext())
    {
      String str = (String)localIterator.next();
      localStringBuilder.append(str).append(" = ").append((String)localHashMap.get(str)).append("\n");
    }
    this.z = localStringBuilder.toString().trim();
    if (TextUtils.isEmpty(this.z))
      this.z = null;
  }

  public void a(String paramString1, String paramString2)
  {
    try
    {
      i locali = (i)this.b.n.a();
      if (locali != null)
        locali.a((a)this.b.h.a(), paramString1, paramString2);
      return;
    }
    finally
    {
    }
  }

  protected void a(LinkedList paramLinkedList)
  {
    try
    {
      Iterator localIterator = paramLinkedList.iterator();
      while (localIterator.hasNext())
      {
        String str = (String)localIterator.next();
        com.google.ads.util.d.a("Adding a click tracking URL: " + str);
      }
    }
    finally
    {
    }
    this.t = paramLinkedList;
  }

  public void a(boolean paramBoolean)
  {
    try
    {
      this.j = paramBoolean;
      return;
    }
    finally
    {
      localObject = finally;
      throw localObject;
    }
  }

  public String b()
  {
    return this.z;
  }

  public void b(long paramLong)
  {
    if (paramLong > 0L);
    try
    {
      this.o.edit().putLong("GoogleAdMobDoritosLife", paramLong).commit();
      return;
    }
    finally
    {
      localObject = finally;
      throw localObject;
    }
  }

  public void b(aa paramaa)
  {
    try
    {
      com.google.ads.util.d.a("AdManager.onGWhirlNoFill() called.");
      a(paramaa.i(), paramaa.c());
      com.google.ads.c localc = (com.google.ads.c)this.b.m.a();
      if (localc != null)
        localc.a((a)this.b.h.a(), com.google.ads.e.b);
      return;
    }
    finally
    {
    }
  }

  protected void b(String paramString)
  {
    try
    {
      com.google.ads.util.d.a("Adding a tracking URL: " + paramString);
      this.s.add(paramString);
      return;
    }
    finally
    {
      localObject = finally;
      throw localObject;
    }
  }

  public void b(boolean paramBoolean)
  {
    this.v = Boolean.valueOf(paramBoolean);
  }

  public void c()
  {
    try
    {
      this.m = false;
      com.google.ads.util.d.a("Refreshing is no longer allowed on this AdView.");
      return;
    }
    finally
    {
      localObject = finally;
      throw localObject;
    }
  }

  public void d()
  {
    try
    {
      if (this.l)
      {
        com.google.ads.util.d.a("Disabling refreshing.");
        this.h.removeCallbacks(this.q);
        this.l = false;
      }
      while (true)
      {
        return;
        com.google.ads.util.d.a("Refreshing is already disabled.");
      }
    }
    finally
    {
    }
  }

  public void e()
  {
    while (true)
    {
      try
      {
        this.n = false;
        if (!this.b.a())
          break label110;
        if (this.m)
        {
          if (!this.l)
          {
            com.google.ads.util.d.a("Enabling refreshing every " + this.p + " milliseconds.");
            this.h.postDelayed(this.q, this.p);
            this.l = true;
            return;
          }
          com.google.ads.util.d.a("Refreshing is already enabled.");
          continue;
        }
      }
      finally
      {
      }
      com.google.ads.util.d.a("Refreshing disabled on this AdView");
      continue;
      label110: com.google.ads.util.d.a("Tried to enable refreshing on something other than an AdView.");
    }
  }

  public void f()
  {
    e();
    this.n = true;
  }

  public as g()
  {
    return this.b;
  }

  public com.google.ads.ac h()
  {
    try
    {
      com.google.ads.ac localac = this.w;
      return localac;
    }
    finally
    {
      localObject = finally;
      throw localObject;
    }
  }

  public j i()
  {
    try
    {
      j localj = this.c;
      return localj;
    }
    finally
    {
      localObject = finally;
      throw localObject;
    }
  }

  public c j()
  {
    try
    {
      c localc = this.f;
      return localc;
    }
    finally
    {
      localObject = finally;
      throw localObject;
    }
  }

  public y k()
  {
    try
    {
      y localy = this.g;
      return localy;
    }
    finally
    {
      localObject = finally;
      throw localObject;
    }
  }

  public w l()
  {
    return this.e;
  }

  public int m()
  {
    try
    {
      int i1 = this.u;
      return i1;
    }
    finally
    {
      localObject = finally;
      throw localObject;
    }
  }

  public long n()
  {
    return this.i;
  }

  public boolean o()
  {
    try
    {
      j localj = this.c;
      if (localj != null)
      {
        bool = true;
        return bool;
      }
      boolean bool = false;
    }
    finally
    {
    }
  }

  public boolean p()
  {
    try
    {
      boolean bool = this.j;
      return bool;
    }
    finally
    {
      localObject = finally;
      throw localObject;
    }
  }

  public boolean q()
  {
    try
    {
      boolean bool = this.l;
      return bool;
    }
    finally
    {
      localObject = finally;
      throw localObject;
    }
  }

  public void r()
  {
    try
    {
      this.e.C();
      com.google.ads.util.d.c("onDismissScreen()");
      com.google.ads.c localc = (com.google.ads.c)this.b.m.a();
      if (localc != null)
        localc.c((a)this.b.h.a());
      return;
    }
    finally
    {
    }
  }

  public void s()
  {
    try
    {
      com.google.ads.util.d.c("onPresentScreen()");
      com.google.ads.c localc = (com.google.ads.c)this.b.m.a();
      if (localc != null)
        localc.b((a)this.b.h.a());
      return;
    }
    finally
    {
    }
  }

  public void t()
  {
    try
    {
      com.google.ads.util.d.c("onLeaveApplication()");
      com.google.ads.c localc = (com.google.ads.c)this.b.m.a();
      if (localc != null)
        localc.d((a)this.b.h.a());
      return;
    }
    finally
    {
    }
  }

  public void u()
  {
    this.e.f();
    x();
  }

  public void v()
  {
    try
    {
      Activity localActivity = (Activity)this.b.e.a();
      if (localActivity == null)
        com.google.ads.util.d.e("activity was null while trying to ping tracking URLs.");
      while (true)
      {
        return;
        Iterator localIterator = this.s.iterator();
        while (localIterator.hasNext())
          new Thread(new n((String)localIterator.next(), localActivity.getApplicationContext())).start();
      }
    }
    finally
    {
    }
  }

  public void w()
  {
    while (true)
    {
      try
      {
        if (this.d == null)
          break label114;
        if (!this.b.a())
          break label105;
        if ((((h)this.b.i.a()).isShown()) && (AdUtil.d()))
        {
          com.google.ads.util.d.c("Refreshing ad.");
          a(this.d);
          if (this.n)
            d();
        }
        else
        {
          com.google.ads.util.d.a("Not refreshing because the ad is not visible.");
          continue;
        }
      }
      finally
      {
      }
      this.h.postDelayed(this.q, this.p);
      continue;
      label105: com.google.ads.util.d.a("Tried to refresh an ad that wasn't an AdView.");
      continue;
      label114: com.google.ads.util.d.a("Tried to refresh before calling loadAd().");
    }
  }

  protected void x()
  {
    try
    {
      Activity localActivity = (Activity)this.b.e.a();
      if (localActivity == null)
        com.google.ads.util.d.e("activity was null while trying to ping click tracking URLs.");
      while (true)
      {
        return;
        Iterator localIterator = this.t.iterator();
        while (localIterator.hasNext())
          new Thread(new n((String)localIterator.next(), localActivity.getApplicationContext())).start();
      }
    }
    finally
    {
    }
  }

  protected void y()
  {
    try
    {
      this.c = null;
      this.k = true;
      this.f.setVisibility(0);
      if (this.b.a())
        a(this.f);
      this.e.g();
      if (this.b.a())
        v();
      com.google.ads.util.d.c("onReceiveAd()");
      com.google.ads.c localc = (com.google.ads.c)this.b.m.a();
      if (localc != null)
        localc.a((a)this.b.h.a());
      return;
    }
    finally
    {
    }
  }
}

/* Location:           D:\Studium\Bachelorarbeit\BA Marcus Wobig\BA\BA\Decompiler\PicturePassword APK\Programm\PicturePassword_dex2jar.jar
 * Qualified Name:     com.google.ads.b.r
 * JD-Core Version:    0.6.2
 */